package config_helper

import (
	"base"
	"config/table"
	"emma/errors"
	"proto/base"
)

type assetHelper struct {
}

var (
	Asset = new(assetHelper)
)

func (helper *assetHelper) Type(id base.AssetItemId) (result base.AssetType, err error) {
	var exists bool
	if result, exists = config_table.Asset.Items[id]; !exists {
		code := int(proto_base.ErrorCode_UndefinedAssetItem)
		err = errors.New(code, "undefined asset item id: %v", id)
	}

	return
}
